package cn.swing.learning;

import javax.swing.*;
import java.awt.*;

/**
 * Desc : TODO
 * ClassName : cn.swing.learning.NullFrame
 *
 * @author : 林鹏群
 * @date : 2022/12/20 16:15
 */
public class NullFrame extends JFrame {

    public NullFrame() {


        //设置标题
        this.setTitle("张三 学号");
        //设置初始化位置
        this.setLocation(500, 500);
        //设置大小
        this.setSize(300,300);
        //设置关闭事件 EXIT_ON_CLOSE
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置图标
        this.setIconImage(new ImageIcon("./picture/icon.gif").getImage());
        //设置布局
        this.setLayout(null);

        JLabel jLabel1 = new JLabel();
        JLabel jLabel2 = new JLabel();
        JLabel jLabel3 = new JLabel();
        JLabel jLabel4 = new JLabel();
        jLabel1.setIcon(new ImageIcon("./picture/blank.gif"));
        jLabel2.setIcon(new ImageIcon("./picture/blank.gif"));
        jLabel3.setIcon(new ImageIcon("./picture/blank.gif"));
        jLabel4.setIcon(new ImageIcon("./picture/blank.gif"));

        jLabel1.setBounds(10,20,50,50);
        jLabel2.setBounds(110,80,50,50);
        jLabel3.setBounds(390,140,50,50);
        jLabel4.setBounds(20,200,50,50);

        this.add(jLabel1);
        this.add(jLabel2);
        this.add(jLabel3);
        this.add(jLabel4);

        //设置大小适应
//        this.pack();
        //设置关闭改变大小
        this.setResizable(false);
        //设置窗体可见
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new NullFrame();
    }
}
